<template name="cart-goods-list">
  <view style="font-size: 0;">
    <loading :showLoaded.sync="showLoaded"></loading>
    <view class="cart_navbar_box" v-if="cartNavbarShow">
      <view v-for="(item, nindex) in cartNavbarLists" :key="nindex" class="cart_navbar_item"
        :style="{color: cartNavbarIndex == nindex ?'#1a1a1a' :'#c6c6c6'}" @click="handleCartNavbar(nindex)">{{item}}
        <image v-if="cartNavbarIndex == nindex" class="vector_icon" src="https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/Vector_icon.png"></image>
      </view>
    </view>
    <!-- 普通商品 -->
    <block v-if="cartNavbarIndex === 0">
      <view class="goodsList" v-if="!buttonShow">
        <!-- 正常商品列表 -->
        <block v-for="(item, index) in listData" :key="index" v-if="item.isGift !== 1">
          <delSlideLeft :item="item" :data_transit="{index:index,type:'noInvalidItem',item:item}" @delItem="handleDelItem" @moveItem="handelMoveItem">
            <view class="list_box">
              <view class="a-goods-conts" :class="item.ischecked ? 'active' : ''">
                <view class="goods-info">
                  <!-- 商品左侧勾选框 -->
                  <view class="check_box">
                    <view class="check_area" @click.stop="handleProductSelect" :data-index="index" :data-id="item.skuId"></view>
                    <view class="icon_checkBox sel_icon" v-if="item.skuProperties[0].approveStatus !== 'instock' && item.stockQty!==0 && item.inValid !== 1" :hidden="!saveHidden">
                      <image style="width:100%;height:100%;" :src="item.isChecked>0 ? iconSel: iconNotSel"></image>
                    </view>

                  </view>
                  <!-- 右侧商品信息 -->
                  <view class="goods_lists_right">
                    <view class="product_img" @click="handleToProductPdp(item.itemId,item.skuProperties[0].valueId,item.skuProperties[0].valueName)">
                      <image :src="item.skuImageUrl"  style="width:100%;height: 100%;"></image>
                    </view>
                    <view class="text-box">
                      <!-- 商品标题 -->
                      <view class="goods-title">
                        <!--失效商品 -->
                        <block v-if="item.inValid == 1">
                          <view style="color: #d8d8d8;" class="ellipsis">{{item.itemName}}</view>
                        </block>
                        <block v-else>
                          <view @click="handleToProductPdp(item.itemId,item.skuProperties[0].valueId,item.skuProperties[0].valueName)">
                            <view class="product_name" v-if='item.itemName'>{{ item.itemName }}</view>
                          </view>
                        </block>
                      </view>
                      <!-- 商品规格 -->
                      <view class="product_model">{{ item.skuProperties[0].valueName }}</view>

                      <view class="promotion-box" v-if="!!item.promotionTagList && item.promotionTagList.length > 0">
                        <block v-for="(promotionTagItem, promotionTagIndex) in item.promotionTagList"
                          :key="promotionTagIndex">
                          <view class="promotion-item" v-if="promotionTagItem.promotionTag">
                            {{promotionTagItem.promotionTag}}
                          </view>
                        </block>
                      </view>
                      <view class="bottomBox">
                        <view class="price">
                          <text class="mark_regular">¥</text>
                          {{filterChecked.moneyFormat(item.price / 1, 2) }}
                        </view>
                        <!-- 库存校验 -->
                        <view class="total-section">
                          <block v-if="item.inValid !== 1">
                            <span v-if="item.safe===0 && item.skuProperties[0].approveStatus !== 'instock'" class="noStock">库存紧张</span>
                            <span v-if="(item.safe===-1 || item.skuProperties[0].approveStatus == 'instock') && item.arrivalNotice == 0"
                              class="soldOut">已售罄</span>
                          </block>
                        </view>
                        <view v-if="item.safe !== -1" class="buy-num">
                          <view class="outerLayer flex_end" @click.stop="jianBtnTap" :data-index="index" :data-id="item.skuId">
                            <image class="numberBtn jian-btn" :src="item.qty === 1 ? goodsOperateBtn.delDisable : goodsOperateBtn.delActive"></image>
                          </view>
                          <view class="cart-number cart_number_box" @click.stop="handleCartInputClick(item, index)">
														{{index === cartInputIndex ? cartInputVal :item.qty}}
													</view>
													<input v-if="index === cartInputIndex"  v-model="cartInputVal" :focus="true"
														class="cart_number_input" type="number"
														@input="handleCartNumberInput" @blur="handleCartNumberBlur" 
														:maxlength="2"
														:data-index="index" :data-id="item.skuId"/>
                          <view class="outerLayer flex_start" @click.stop="jiaBtnTap" :data-index="index" :data-id="item.skuId">
                            <image class="numberBtn jia-btn numjia "
                              :src="item.stockQty === item.qty || (item.qty >= item.limitPurchaseQty && item.limitPurchaseQty != -1) ?  goodsOperateBtn.addDisable :  goodsOperateBtn.addActive">
                            </image>
                          </view>
                        </view>
                      </view>
                    </view>
                  </view>
                </view>
              </view>
            </view>
          </delSlideLeft>
        </block>


        <!-- 失效商品 -->
        <view v-if="!!invalidList && invalidList.length > 0 && !buttonShow">
          <view class="block_title" :style="{paddingTop: listData.length ? '80rpx': '0rpx'}">已失效商品</view>
          <block v-for="(item, index) in invalidList" :key="index">
            <delSlideLeft :item="item" :data_transit="{index:index,type:'invalidItem',item:item}" @delItem="handleDelItem" @moveItem="handelMoveItem">
              <view class="list_box noGoods">
                <view class="a-goods-conts">
                  <view class="goods-info">
                    <!-- 商品左侧勾选框 -->
                    <view class="check_box">
                      <view class="icon_checkBox sel_icon">
                        <image style="width:100%;height:100%;" :src="iconDisabled"></image>
                      </view>
                    </view>
                    <view class="goods_lists_right" @click="handleToProductPdp(item.itemId,item.skuProperties[0].valueId)">
                      <view class="product_img">
                        <image :src="item.skuImageUrl" style="width:100%;height: 100%;"></image>
                      </view>
                      <view class="text-box">
                        <!-- 商品名称 -->
                        <view class="invalid_color product_name">{{item.itemName}}</view>
                        <!-- 商品规格 -->
                        <view class="product_model">{{ item.skuProperties[0].valueName }}</view>
                        <view class="bottomBox" style="justify-content: flex-start;">
                          <view class="price invalid_color" style="width: auto;margin-right: 16rpx;">
                            <text class="mark_regular">¥</text>
                            {{filterChecked.moneyFormat(item.price / 1, 2) }}
                          </view>
                          <!-- 库存校验 -->
                          <view class="invalid_product_status invalid_color">
                            <block v-if="item.skuProperties[0].approveStatus !== 'onsale'">
                              已下架
                            </block>
                            <block v-else>
                              {{item.stockQty < 1 || isBlackListUser?'已售罄':''}}
                            </block>
                          </view>
                        </view>
                      </view>
                    </view>
                   </view>
                </view>
              </view>
            </delSlideLeft>
          </block>
        </view>

      </view>
      <!-- 购物车为空 -->
      <view v-if="buttonShow" class="empty-cartHidden" :class="buttonShow ? 'empty_cart' : ''">
        <image class="icon-xl" src="https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/cart/empty_cart_logo4x.png" />
        <view class="empty_cart_text">暂无商品</view>
        <view class="shop_btn">
          <view class="block btn_group">
            <view v-if="buttonShow" class="get_store" @click="goIndex">来点灵感</view>
          </view>
        </view>
      </view>
    </block>
    <block v-if="cartNavbarIndex === 1">
      <view class="goodsList" v-if="!buttonShow">
        <!-- 正常商品、售罄商品列表 -->
        <block v-for="(item, index) in tsListData" :key="index" v-if="item.isGift !== 1">
          <delSlideLeft :item="item" :data_transit="{index:index,type:'noInvalidItem',item:item}" @delItem="handleDelItem" @moveItem="handelMoveItem">
            <view class="list_box" :class="item.inValid == 1 ? 'noGoods':''">
              <view class="a-goods-conts" :class="item.ischecked ? 'active' : ''">
                <view class="goods-info">
                  <!-- 商品左侧勾选框 -->
                  <view class="check_box">
                    <view class="check_area" @click.stop="handleTSproductSelect" :data-index="index" :data-id="item.skuId"></view>
                    <view class="icon_checkBox sel_icon" v-if="item.skuProperties[0].approveStatus !== 'instock' && item.stockQty!==0 && item.inValid !== 1" :hidden="!saveHidden">
                      <image style="width:100%;height:100%;" :src="item.isChecked>0 ? iconSel: iconNotSel"></image>
                    </view>
                  </view>
                  <!-- 右侧商品信息 -->
                  <view class="goods_lists_right">
                    <view class="product_img" @click="handleToProductPdp(item.itemId,item.skuProperties[0].valueId,item.skuProperties[0].valueName)">
                      <image :src="item.skuImageUrl"  style="width:100%;height: 100%;"></image>
                    </view>

                    <view class="text-box">
                      <!-- 商品标题 -->
                      <view class="goods-title">
                        <!--失效商品 -->
                        <block v-if="item.inValid == 1">
                          <view style="color: #d8d8d8;" class="ellipsis">{{item.itemName}}</view>
                        </block>
                        <block v-else>
                          <view @click="handleToProductPdp(item.itemId,item.skuProperties[0].valueId,item.skuProperties[0].valueName)">
                            <view class="product_name" v-if='item.itemName'>{{ item.itemName }}</view>
                          </view>
                        </block>
                      </view>
                      <!-- 商品规格 -->
                      <view class="product_model">{{ item.skuProperties[0].valueName }}</view>

                      <view class="promotion-box" v-if="!!item.promotionTagList && item.promotionTagList.length > 0">
                        <block v-for="(promotionTagItem, promotionTagIndex) in item.promotionTagList"
                          :key="promotionTagIndex">
                          <view class="promotion-item" v-if="promotionTagItem.promotionTag">
                            {{promotionTagItem.promotionTag}}
                          </view>
                        </block>
                      </view>
                      <view class="bottomBox">
                        <view class="price">
                          <text class="mark_regular">¥</text>
                          {{filterChecked.moneyFormat(item.price / 1, 2) }}
                        </view>
                        <!-- 库存校验 -->
                        <view class="total-section">
                          <block v-if="item.inValid !== 1">
                            <span v-if="item.safe===0 && item.skuProperties[0].approveStatus !== 'instock'" class="noStock">库存紧张</span>
                            <span v-if="(item.safe===-1 || item.skuProperties[0].approveStatus == 'instock') && item.arrivalNotice == 0"
                              class="soldOut">已售罄</span>
                          </block>
                        </view>
                        <view v-if="item.safe !== -1" class="buy-num">
                          <view class="outerLayer flex_ends" @click.stop="jianBtnTap" :data-index="index" :data-id="item.skuId">
                            <image class="numberBtn jian-btn" :src="item.qty === 1 ? goodsOperateBtn.delDisable : goodsOperateBtn.delActive"></image>
                          </view>
                          <view class="cart-number cart_number_box" @click.stop="handleCartInputClick(item, index)">
                          	{{index === cartInputIndex ? cartInputVal :item.qty}}
                          </view>
                          <input v-if="index === cartInputIndex"  v-model="cartInputVal" :focus="true"
                          	class="cart_number_input" type="number" 
                          	@input="handleCartNumberInput" @blur="handleCartNumberBlur" 
														:maxlength="2"
                          	:data-index="index" :data-id="item.skuId"/>
                          <view class="outerLayer flex_start" @click.stop="jiaBtnTap" :data-index="index" :data-id="item.skuId">
                            <image class="numberBtn jia-btn numjia "
                              :src="item.stockQty === item.qty || (item.qty >= item.limitPurchaseQty && item.limitPurchaseQty != -1) ?  goodsOperateBtn.addDisable :  goodsOperateBtn.addActive">
                            </image>
                          </view>
                        </view>
                      </view>
                    </view>
                  </view>
                </view>
              </view>
            </view>
          </delSlideLeft>
        </block>
        <!-- 失效商品 -->
        <view v-if="!!invalidListTS && invalidListTS.length > 0 && !buttonShow">
          <view class="block_title" :style="{paddingTop: tsListData.length ? '80rpx': '0rpx'}">已失效商品</view>
          <block v-for="(item, index) in invalidListTS" :key="index">
            <delSlideLeft :item="item" :data_transit="{index:index,type:'invalidItem',item:item}" @delItem="handleDelItem" @moveItem="handelMoveItem">
              <view class="list_box noGoods">
                <view class="a-goods-conts">
                  <view class="goods-info">
                    <!-- 商品左侧勾选框 -->
                    <view class="check_box">
                      <view class="icon_checkBox sel_icon">
                        <image style="width:100%;height:100%;" :src="iconDisabled"></image>
                      </view>
                    </view>
                    <view class="goods_lists_right" @click="handleToProductPdp(item.itemId,item.skuProperties[0].valueId)">
                      <view class="product_img">
                        <image :src="item.skuImageUrl" style="width:100%;height: 100%;"></image>
                      </view>
                      <view class="text-box">
                        <!-- 商品名称 -->
                        <view class="invalid_color product_name">{{item.itemName}}</view>
                        <!-- 商品规格 -->
                        <view class="product_model">{{ item.skuProperties[0].valueName }}</view>
                        <view class="bottomBox" style="justify-content: flex-start;">
                          <view class="price invalid_color" style="width: auto;margin-right: 16rpx;">
                            <text class="mark_regular">¥</text>
                            {{filterChecked.moneyFormat(item.price / 1, 2) }}
                          </view>
                          <!-- 库存校验 -->
                          <view class="invalid_product_status invalid_color">
                            <block v-if="item.skuProperties[0].approveStatus !== 'onsale'">
                              已下架
                            </block>
                            <block v-else>
                              {{item.stockQty < 1 || isBlackListUser?'已售罄':''}}
                            </block>
                          </view>
                        </view>
                      </view>
                    </view>
                   </view>
                </view>
              </view>
            </delSlideLeft>
          </block>
        </view>
      </view>
    </block>
    <image style="width:750rpx;height:12rpx;" src="https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/cart/empty_cart_line3x.png"></image>
    <!-- 最近浏览 -->
    <view class="recently_viewed" v-if="userBrowsingLists.length">
      <view class="block_title" style="padding-bottom: 64rpx;">最近浏览</view>
      <scroll-view class="recently_lists_box" :scroll-x="true" :bounces="false" @scroll="handleBrowsingScroll">
        <view class="recently_lists_inner">
          <block v-for="(item,index) in userBrowsingLists" :key="index">
            <view class="recently_lists_item">
              <view class="lists_img_box">
                <image style="width: 100%;height: 100%;" :src="item.img" @click="handleToProductPdp2(item)"></image>
                <view class="cart_btn" v-if="item.qty" @click="handleAddCart(item)"></view>
              </view>
              <view class="lists_classname text24">{{item.className}}</view>
              <view class="lists_itemname text24">{{item.itemName}}</view>
              <view class="lists_price text24"><view class="text24 lists_price_yuan">￥</view>{{filterChecked.moneyFormat(item.price / 1, 2) }}</view>
            </view>
          </block>
        </view>
      </scroll-view>
      <view class="recently_lists_progress" :style="{opacity: userBrowsingLists.length >2 ? 1 : 0}">
        <view class="recently_lists_progress_bg"></view>
        <view class="recently_lists_progress_line" :style="{transform: 'translateX('+browsingProgressLeft+'rpx)'}"></view>
      </view>
    </view>
    <!-- 结算按钮 -->
    <view class="jiesuan-box" :class="[customTabbar === 1 ? (isIpx ? 'jiesuan-box-ipx' : 'customer-tabbar') : '']"
      v-if="listData.length > 0 || tsListData.length > 0">
      <view class="left-price">
        <view @click.stop="handleSelectAll" class="all_select_box">
          <view class="sel_icon">
            <image style="width:100%;height:100%;" :src="allChecked ? iconSel: iconNotSel"></image>
          </view>
          <view class="all_select">全选</view>
        </view>
      </view>
      <view class="right-price">
        <view class="total_box" :hidden="noSelect">
          <view class="total_text">合计：</view>
          <view class="total">
            <!-- 合计： -->
            <text class="mark" style="font-weight: 500;">¥</text>
            {{ payment / 1 == null ? '0' : filterChecked.moneyFormat(payment, 2) }}
          </view>
          <view class="sale" v-if="disTotal / 1">已优惠：{{ '¥ ' + filterChecked.moneyFormat(disTotal, 2) }}</view>
        </view>
        <view class="to-pay-btn" :class="totalPrice == '0.00' ? 'no-select' : ''" :hidden="!saveHidden"
          @click="toPayOrder">{{btnTextContent}}</view>
      </view>
    </view>
    <!-- 删除确认 -->
    <view v-if="deltext">
      <view :class="deltext ? 'o-contain' : 'is-hidden'">
        <h2 class="a-heading-2">您确认删除该商品吗？</h2>
        <button @click.stop="handleCancel" class="a-button is-secondary"><span>再考虑下</span></button>
        <button v-if="deltext" @click.stop="delItemHandle" class="a-button is-primary">确认删除</button>
      </view>
    </view>
    <!-- //删除确认 -->

    <!-- 清空无效商品确认 -->
    <view v-if="canClearInvalidItems">
      <view :class="canClearInvalidItems ? 'o-contain' : 'is-hidden'">
        <h2 class="a-heading-2">您确认清空无效商品吗？</h2>
        <button @click.stop="handleCancel" class="a-button is-secondary">
          <span>再考虑下</span>
        </button>
        <button @click.stop="clearInvalidItemHandle" class="a-button is-primary">确认清空</button>
      </view>
    </view>
    <cart-toast v-if="showCartMsg" :cartMessage='cartMessage' :cartStatus='cartStatus' ></cart-toast>
		<!-- 弱提示 弹窗 -->
		<toast-popup ref="toastPopup" @onToastPopupClick="onToastPopupClick"></toast-popup>
  </view>
</template>
<script module="filterChecked" lang="wxs" src="../../utils/filter.wxs"></script>
<script>
  import api from '@/api/api';
  import util from '@/utils/util';
  import {
    CUSTOMER_INFO,
    MERCHANT_INFO,
    USER_INFO,
    CART_KEY,
    USER_SPECICAL_INFO,
    ADDRESS_ID
  } from '@/utils/constant';
  import TabBar from '@/components/common/tabbar';
  import Loading from '@/components/common/loading';
  import delSlideLeft from '@/pages/ay-operate/del_slideLeft_cart.vue';
  import commonImages from '@/utils/commonImages';
  import CartToast from '@/components/common/cartToast.vue';
  export default {
    components: {
      loading: Loading,
      tabBar: TabBar,
      delSlideLeft,
      CartToast
    },
    props: {
      isIpx: Boolean,
      isSystem: Boolean,
      toTop: Boolean
    },
    data() {
      return {
        btnTextContent: this.$programSetting.openAppointment ? '预约' : '结算',
        customTabbar: -1,
        shopCartAgain: [],
        deltext: false,
        delIndex: '',
        listData: [],           //  购物车普通商品列表
        tsListData: [],         //  购物车ts商品列表
        cartNavbarShow: false,     //  购物车navbar是否展示
        cartNavbarIndex: 0,     //  购物车navbar选择下标
        cartNavbarLists:["购物袋","专享商品"],
        cartHaveQty: [],        //  有库存商品集合-普通商品
        cartHaveQtyTS: [],        //  有库存商品集合-TS商品
        noSelect: false,
        saveHidden: true,
        totalPrice: 0,
        payment: 0, // 总价
        itemTotal: 0,
        discountFee: 0,
        couponFee: 0,
        disTotal: 0,
        maxQty: 0,
        operating: false,
        operatingTime: 0,
        allChecked: true,
        checkedNum: 0,
        safeNum: 2, //安全库存
        cartKey: '',
        totalNum: 0,
        buttonShow: false,    //  购物车是否展示
        nowPages: '',
        cartNum: 0,
        showLoaded: true,   //  是否展示loading
        touchStartTime: '',
        giftName: '',
        isShowCouponList: false,
        couponMessage: '',
        couponValue: '',
        couponShow: false,
        itemName: [],
        subscribeMessage: [],
        postFee: '',
        getCoupon: 0,           // 是否显示可用优惠券
        couponRuleIds: '',
        usableCoupon: [],       // 可用优惠券列表
        couponRuleName: '',
        cartBagItems: [],       //  购物车原始数据
        showSignBox: false,
        ifShowDiscount: false,
        topBoxSmallTitle: '您的消费已满1万',
        signDataInfo: {},
        crmSignStateObj: {},
        placeholder: '请输入优惠券暗号',
        showUseCoupon: false,   //  是否展示输入优惠券的文本框
        height: 0,
        statusBarHeight: 0,
        titleBarHeight: 0,
        discountsArr: [],
        saveCoupon: '',
        errorCouponWarn: '',
        imageHeight: 206,
        isPb: -1,
        invalidList: [],              // 失效商品
        invalidListTS: [],              // 失效TS商品
        canClearInvalidItems: false, // 清空失效商品弹框
        delInvalidItem: false,
        onlyFreight: false,

        imgurl: 'https://100000063-1252208446.cos.ap-shanghai.myqcloud.com/images/miniprogram/%20images/none.png',
        keyWordInfo: '去逛逛',
        isBlackListUser: false,
        limitSkuID: '',
        goodsOperateBtn: commonImages,
        userBrowsingLists:[],     //  最近浏览集合
        browsingProgressLeft: 0,  //  最近浏览进度条
        systemInfomations: null,
        registerType: '',     //cart 点击加购按钮，nonMember点击入会按钮赋的值
        cartMessage:'',       //  加入购物车提示语
        showCartMsg:false,
        cartStatus: false,    //  加入购物车是否成功
        iconSel: "",
        iconNotSel: "",
        iconDisabled: "",
        cartNavbarClick: false,
				
				cartInputVal: 1,	//	键盘修改数量
				cartInputIndex: -1
      };
    },
    onShow(e) {
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 0
      });
    },
    async mounted() {
      const member = await this.getMemberDetail();
      if(member){
        this.initUserCart();
      }else{
        this.showLoaded = false;
        this.buttonShow = true;
      }

      uni.pageScrollTo({
        scrollTop: 0,
        duration: 0
      });

      const { select_icon, noselect_icon, disabled_icon } = require('./icon.svg.js');
      this.iconSel = select_icon();
      this.iconNotSel = disabled_icon();
      this.iconDisabled = disabled_icon();

      this.customTabbar = this.$programSetting.customTabbar ? 1 : 0
      let merchantInfo = uni.getStorageSync(MERCHANT_INFO);
      this.isPb = merchantInfo.cloudMerchantId == 100000057 ? 1 : 0;
      this.imageHeight = 136 / uni.getStorageSync('imageScaling');
      this.systemInfomations = uni.getSystemInfoSync();
      let totalTopHeight = 76;
      if (this.systemInfomations.model.indexOf('iPhone X') !== -1 || this.systemInfomations.model.indexOf('iPhone1') !== -1) {
        totalTopHeight = 88;
      } else if (this.systemInfomations.model.indexOf('iPhone') !== -1) {
        totalTopHeight = 64;
      }
      this.statusBarHeight = this.systemInfomations.statusBarHeight || this.systemInfomations.statusbarHeight;
      let statusBarHeight = this.systemInfomations.statusBarHeight || this.systemInfomations.statusbarHeight;
      this.height = totalTopHeight;
      this.titleBarHeight = totalTopHeight - statusBarHeight;
      this.operating = false;
      let pages = getCurrentPages();
      let currPage = pages[pages.length - 1];
      this.nowPages = currPage.route;
    },
    watch: {
      toTop: function(val) {},
      // reason: function(val) {
      //   if (this.orderItemId.length > 0 && val) {
      //     this.buttonFlag = true
      //   } else {
      //     this.buttonFlag = false
      //   }
      // }
    },
    methods: {
			/**
			 * 展示弱提示
			 * @param {Object} msg 文案
			 */
			handleShowTextToast(msg){
				try{
					this.$refs.toastPopup.showToast(msg);
				}catch(e){}
			},
			/**
			 * 若提示按钮点击回调
			 * @param {Object} data.type 类型：confirm确定，cancel取消
			 * @param {Object} data.callBackData 呼气弹窗时传入的数据
			 */
			onToastPopupClick(data){},
      /**
       * 获取用户会员信息
       * @param jwt
       * @return {Promise<void>}
       */
      async getMemberDetail() {
        try{
          let that = this;
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || that.globalData.customerInfo;
          if(!customerInfo || !customerInfo.jwt) return false;
          const memberDetailsResult = await api.getMemberDetails({
            header: {
              jwt: customerInfo.jwt || jwt
            }
          });
          if (memberDetailsResult.code == 1000) {
            const phoneNumberReg = /^1\d{10}$/;
            if(!phoneNumberReg.test(memberDetailsResult.data.mobile)){
              return false;
            }
            return true;
          }
          return false;
        }catch(e){
          return false;
        }
      },
      /**
       * 商品加入购物车功能
       * @param {Object} item
       */
      async handleAddCart(item) {
				const cartRes = await this.$commonFunction.buildProductsAddCart({
					price: item.skus[0].price,
					itemId: item.itemId,
					valueId: item.itemData.frontProperties[0].valueId,
					itemCode: item.itemId,
					itemName: item.itemName,
					qty: 1,
					skuCode: item.skus[0].skuCode,
					skuId: item.skus[0].skuId
				});
				this.handleCartToast(cartRes);
				
				this.buildSrDataTrack(item,"addCartClick");
      },
      /**
       * 加购提示
       * @param {Object} obj
       */
      async handleCartToast(obj){
				const _arr = ['您动作太快，请慢点哟～', '网络状态不佳，请重试'];
				if(obj.msg && _arr.includes(obj.msg)){
					this.handleShowTextToast(obj.msg)
				}else if(obj.data && obj.data.msg && obj.data.type === 'showToast'){
					this.handleShowTextToast(obj.data.msg)
				}else{
					if(obj?.success) this.getCartItems();
					this.cartMessage = obj?.msg || "加入购物袋失败";
					this.cartStatus = obj?.success || false;
					this.showCartMsg = true;
					setTimeout(()=>{
						this.showCartMsg = false;
					},3000);
				}
      },
      //  最近浏览 scroll-view滚动回调
      async handleBrowsingScroll(e){
        const {detail:{scrollWidth,scrollLeft,deltaX}} = e;
        let _percent = Math.round((scrollLeft / (scrollWidth-this.systemInfomations.windowWidth+deltaX)) * 100) / 100;
         _percent = _percent < 0.1 ? 0 : _percent >=1 ? 1 : _percent;
        this.browsingProgressLeft = 240 * _percent;
      },
      /**
       *  购物车最近浏览-查询浏览记录
       *  在父级onShow方法中触发
       * @returns {Promise<void>}
       */
      async handleGetRecentBrowsing(){
        const that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
        if(!customerInfo || !customerInfo?.openId) return;

        let merchantInfo = uni.getStorageSync('merchantInfo') || (await getApp().getMerchantInfo());
        //  购物车最近浏览-查询浏览记录
        const resData = await api.getRecentBrowsing({
          open_id: customerInfo.openId
        });
        if(resData && resData.success && resData.data.length){
          let _browsingArr = [];
          let _itemCodeArr = [];
          const _goodsLists = resData.data || [];
          if(!_goodsLists.length) return;
          // 轮训查询商品详情
          for (let i = 0; i < _goodsLists.length; i++) {
            const _vid = _goodsLists[i]?.records ? JSON.parse(_goodsLists[i].records)?.valueId : 0;
            _goodsLists[i].valueId = _vid;

            //  查询单个商品详情 获取商品信息
            const _tagGoods = await api.goodsDetail({
                query: {
                  merchant_id: merchantInfo.cloudMerchantId,
                  store_id: merchantInfo.cloudMerchantStoreId
                }
              },
              _goodsLists[i].itemId
            );
            if (_tagGoods.code === 1000) {
              const _tagdata = _tagGoods.data;
              const _price = _tagdata?.skus.length ? _tagdata?.skus[0].price : 0;
              const _markingPrice = _tagdata?.skus.length ? _tagdata?.skus[0].markingPrice : 0;

              _goodsLists[i].isSpecial = false;
              _goodsLists[i].isC2Bgoods = false;

              if(_tagdata.itemCustomParameters){
                try{
                  const _resData = JSON.parse(_tagdata.itemCustomParameters);
                  if(_resData.isLuckyDrawItem){
                    _goodsLists[i].isSpecial = true;
                  }
                }catch(e){}
              }

              //  判断商品是否参加活动
              let jsonData = await api.getDrawInfo({
                method: 'GET',
                query: {
                  store_id: merchantInfo.cloudMerchantStoreId,
                  merchant_id: merchantInfo.cloudMerchantId,
                  customer_id: customerInfo ? customerInfo.customerId : '',
                  item_id: _goodsLists[i].itemId,
                  value_id: _goodsLists[i].valueId
                }
              });
              if(jsonData && jsonData.code === 1000 && jsonData.data){
                _goodsLists[i].isSpecial = true;
              }

              _goodsLists[i].itemData = _tagdata;
              _goodsLists[i].img = "";
              const _hdlpObj = _tagdata.resources.find((item)=>item.kind == "hdlp");
              if(_hdlpObj && _hdlpObj.kind == "hdlp" && _hdlpObj.type == "image" && _hdlpObj.url) _goodsLists[i].img = _hdlpObj.url;

              _goodsLists[i].itemName = _tagdata?.itemName || "";
              _goodsLists[i].qty = _tagdata?.qty || 0;
              _goodsLists[i].price = _price <= 0 ? Number(_markingPrice) : Number(_price);
              _goodsLists[i].itemCode = _tagdata?.itemCode || "";
              _goodsLists[i].skuCode = (_tagdata?.skus && _tagdata?.skus[0] && _tagdata?.skus[0]?.skuCode) ? _tagdata.skus[0].skuCode : "";
              _goodsLists[i].skus = _tagdata?.skus || "";
              //  暂存itemCode 用于调用批量查询实时库存接口
              if(_goodsLists[i].skuCode) _itemCodeArr.push(_goodsLists[i].skuCode);
              //  策略价格处理逻辑
              _goodsLists[i] = await that.getPriceRules(_goodsLists[i]);
              _tagdata.frontProperties.forEach(item=>{
                if(item?.subtitle){
                  _goodsLists[i].itemName = item.subtitle;
                }
                if(item.frontCustomParameters){
									const _frontCustomParameters = JSON.parse(item.frontCustomParameters);
									//	判断商品是否为c2b定制商品
									if(_frontCustomParameters['c2bGoods'] == 1){
										_goodsLists[i].isC2Bgoods = true;
									}
                  if (_frontCustomParameters['privateSaleMark'] == 1) {
                    //特殊购买自定义参数为1时是特殊购买商品isSpecial为true
                    _goodsLists[i].isSpecial = true;
                  }
                  if (_frontCustomParameters['intentCheckMark'] == 1) {
                    //意向登记
                    _goodsLists[i].isSpecial = true;
                  }
                }
                //  最近浏览只展示上架的商品
                if(item.approveStatus == "onsale" && item.valueId == Number(_vid)){
                  //  商品图片 先取高清大图，若没有则取悬浮图字段 hoverUrl
                  if(!_goodsLists[i].img) _goodsLists[i].img = item?.hoverUrl;

                  //  自定义分类名称
                  _goodsLists[i].className = item?.frontCustomParameters ? JSON.parse(item?.frontCustomParameters)?.className : "";
                  _browsingArr.push(_goodsLists[i]);
                }
              });
            }
          }
          //  查询浏览商品实时库存
          const _availableQty = await that.getAvailableBatchQty(customerInfo, merchantInfo, _itemCodeArr);
          if(_availableQty && _availableQty.length){
            _browsingArr.forEach(item=>{
              if(item.isSpecial){
                //  当前商品为 TS/抽签购商品，不展示加购按钮
                item.qty = 0;
              }else{
                _availableQty.forEach(el=>{
                  if(item.skuCode == el.skuCode) item.qty = el.availableQty < 1 ? 0 : el.availableQty;
                })
              }
            })
          }
          that.userBrowsingLists = _browsingArr;
        }else{
          that.userBrowsingLists = [];
        }
      },
      /**
       *  查询实时库存
       */
      async getAvailableBatchQty(customerInfo, merchantInfo, itemCodeArr){
        if(!itemCodeArr || !itemCodeArr.length) return [];
        const res = await api.getAvailableBatchQty({
          method: "POST",
          header: {
            jwt: customerInfo.jwt,
            'content-type': 'application/json'
          },
          // query: JSON.stringify(itemCodeArr)
          query: itemCodeArr
        }, merchantInfo.cloudMerchantId);
        if(res && res.code === 1000) return res?.data || [];
        return [];
      },
      /**
       *  价格策略
       */
      async getPriceRules(itemObj) {
        try{
          let that = this;
          return new Promise(async (resolve, reject) => {
            let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
            let memberDetails = uni.getStorageSync('memberDetails') || getApp().globalData.memberDetails;
            if (!itemObj.valueId) resolve(itemObj);
            const json = await api.getPriceRules({
                query: {
                  group_id: customerInfo.groupId || 0,
                  member_level_id: memberDetails.memberLevelId || 0,
                  member_status: memberDetails.isActive || 'Inactive'
                }
              },
              uni.getStorageSync(MERCHANT_INFO).cloudMerchantId,
              itemObj.itemId,
              itemObj.valueId
            );
            if (json?.code === 1000 && json?.data.length) {
              const res = await that.$commonFunction.priceRulesDeal(json.data, itemObj.itemCode);
              if (res.price !== 0 && itemObj.itemCode == res.itemCode) itemObj.price = res.price
              if (res.rulesArr.length > 0) itemObj.rulesArr = res.rulesArr;
            }
            resolve(itemObj);
          })
        }catch(e){
          resolve(itemObj);
        }
      },
      /**
       * nvabar点击事件，切换到普通商品时TS商品全部取消选择，反之亦然
       * @param index   navbar下标
       * @returns {Promise<void>}
       */
      async handleCartNavbar(index){
        this.showLoaded = true;
        this.cartNavbarIndex = index;
        this.cartNavbarClick = true;
        this.$emit('navItemClick', index);
        let _selArr = [];
        this.payment = 0; // 总计 清空
        this.totalPrice = '0.00';
        if(index == 0){
          //  TS商品全部取消选择
          for (let i = 0; i < this.cartHaveQtyTS.length; i++) {
            const _tag = this.cartHaveQtyTS[i];
            if(_tag.isChecked) await this.checkGoods(_tag.skuId, 0);
          }
          // 普通商品 是否全部选中
          for (let j = 0; j < this.cartHaveQty.length; j++) {
            if (this.cartHaveQty[j].isChecked) _selArr.push(j);
          }
          this.allChecked = (this.cartHaveQty.length === _selArr.length && this.cartHaveQty.length) ? true : false;
        }else{
          //  普通商品全部取消选择
          for (let i = 0; i < this.cartHaveQty.length; i++) {
            const _tag = this.cartHaveQty[i];
            if(_tag.isChecked) await this.checkGoods(_tag.skuId, 0);
          }
          // TS商品 是否全部选中
          for (let j = 0; j < this.cartHaveQtyTS.length; j++) {
            if (this.cartHaveQtyTS[j].isChecked) _selArr.push(j);
          }
          this.allChecked = (this.cartHaveQtyTS.length === _selArr.length && this.cartHaveQtyTS.length) ? true : false;
        }
        this.getCartItems();
      },
      /*
       * 神策埋点
       */
      viewTrack() {
        let that = this;
        const _lists = that.listData.concat(that.tsListData);
        that.$commonSensors.commonOrderView('ViewCart', _lists)
      },
      /**
       * 最近浏览跳转商品详情页
       * @param id   商品skuId
       * @param valueId
       * @param valueName
       * @returns {Promise<void>}
       */
      handleToProductPdp2(item) {
        this.buildSrDataTrack(item,"itemClick");
        let url = '/pages/item/item';
        wx.navigateTo({
        	url: item.itemData.itemId? `${url}?id=${item.itemData.itemId}&valueId=${item.itemData.valueId}` : '/pages/GTR/item?id=' + item.itemData.id
        })
      },
      /**
       * 有数埋点数据组装
       * @param {Object} item
       * @param {Object} type
       */
      async buildSrDataTrack(item, type){
        const _itemData = item.itemData || null;
        if(_itemData){
          const _srParams = {
            skuCodes: [_itemData.itemCode || ""],
            itemName: _itemData.itemName || "",
            outerItemId: _itemData.outerItemId || "",
            frontProperties: _itemData.frontProperties || [],
            itemCode: _itemData.itemCode || "",
            categoryId:  _itemData.categoryId || "",
            skuImageUrl:  _itemData.frontProperties[0].skuImageUrl || ""
          }
          this.$commonUtoolsTrack.tencentYoushuTracking(_srParams, type);
        }
      },
      /**
       * 跳转商品详情页
       * @param id   商品skuId
       * @param valueId
       * @param valueName
       * @returns {Promise<void>}
       */
      handleToProductPdp(id,valueId,valueName) {
        const _query = valueName ? `id=${id}&valueId=${valueId}&valueName=${valueName}` : `id=${id}&valueId=${valueId}`;
        uni.navigateTo({
          url: `/pages/item/item?${_query}`
        })
      },
      // 清空失效商品
      clearInvalidItem() {
        this.canClearInvalidItems = true;
      },
      // 清空购物车无效商品
      async clearInvalidItemHandle() {
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || '';
        let cart_key = this.getCartKey();
        const emptyRs = await api.emptyInvalidItems({
          method: 'POST',
          header: {
            'jwt': customerInfo.jwt
          },
          query: {
            cart_key: cart_key
          }
        }, cart_key);
        if (emptyRs.code === 1000) {
          this.getCartItems();
        }
        this.canClearInvalidItems = false;
      },
      handelMoveItem(e) {
        this.$emit('moveShopItem', e);
      },
      //  删除购物车商品
      handleDelItem(itemData) {
        this.showLoaded = true;
        this.delInvalidItem = false;
        let itemType = itemData.data.type;
        if (itemType == 'invalidItem') {
          this.delInvalidItem = true;
          this.delIndex = parseInt(itemData.data.index + 0);
        } else {
          this.delIndex = parseInt(itemData.data.index + 0);
        }
        // this.deltext = true;
        this.delItemHandle();
      },
      //  确认删除购物车商品
      delItemHandle() {
        let _tag = null;
        if (this.delInvalidItem) {
          _tag = this.cartNavbarIndex == 0 ? this.invalidList[this.delIndex] : this.invalidListTS[this.delIndex];
          this.deleteGoods(_tag);
        } else {
          _tag = this.cartNavbarIndex == 0 ? this.listData[this.delIndex] : this.tsListData[this.delIndex];
          this.deleteGoods(_tag);
        }
        this.deltext = false;
        this.$commonSensors.editCart(_tag, _tag.qty, !!_tag.tsActivityMark ? ['特殊'] : ['常规'], '删除')
      },
      // 取消删除购物车中的商品
      handleCancel() {
        this.canClearInvalidItems = false;
        this.deltext = false;
      },
      // 普通商品购物车选择和取消选择
      async handleProductSelect(e) {
        const { currentTarget: { dataset: { id,index }}} = e;
        const _index = parseInt(index);
        // 反选isChecked
        let ischecked = this.cartHaveQty[_index].isChecked ? 0 : 1;
        let stockQty = this.cartHaveQty[_index].stockQty;
        let ischeckedNum = [];
        let flag = await this.checkGoods(id, ischecked, true);
        if (!flag) return false;

        // 如果没有库存选择按钮隐藏
        if (stockQty == 0) {
          this.cartHaveQty[_index].isChecked = 0;
          this.operating = false;
          this.handleShowTextToast('没有库存');
          this.saveHidden = false;
          return false;
        }

        for (var j = 0; j < this.cartHaveQty.length; j++) {
          if (this.cartHaveQty[j].isChecked == 1) ischeckedNum.push(this.cartHaveQty[j]);
        }
        this.checkedNum = ischeckedNum.length;
        if (this.allChecked == true) {
          this.checkedNum = this.cartHaveQty.length;
        }
        // 选择数量等于全部数量时
        if (this.cartHaveQty[_index].isChecked === 0) {
          this.checkedNum++;
        } else {
          if (this.checkedNum <= 0) {
            this.checkedNum = 0;
          } else {
            this.checkedNum--;
          }
        }
        this.allChecked = this.checkedNum === this.cartHaveQty.length;
        if (this.cartHaveQty.length == 1 && this.cartHaveQty[_index].ischecked == 1) {
          this.allChecked = true;
        }
      },
      // TS商品购物车选择和取消选择
      async handleTSproductSelect(e) {
        const { currentTarget: { dataset: { id,index }}} = e;
        const _index = parseInt(index);
        // 反选isChecked
        let ischecked = this.cartHaveQtyTS[_index].isChecked ? 0 : 1;
        let stockQty = this.cartHaveQtyTS[_index].stockQty;
        let ischeckedNum = [];
        let flag = await this.checkGoods(id, ischecked, true);
        if (!flag) return false;

        // 如果没有库存选择按钮隐藏
        if (stockQty == 0) {
          this.cartHaveQtyTS[_index].isChecked = 0;
          this.operating = false;
          this.handleShowTextToast('没有库存');
          this.saveHidden = false;
          return false;
        }

        for (var j = 0; j < this.cartHaveQtyTS.length; j++) {
          if (this.cartHaveQtyTS[j].isChecked == 1) ischeckedNum.push(this.cartHaveQtyTS[j]);
        }
        this.checkedNum = ischeckedNum.length;
        if (this.allChecked == true) {
          this.checkedNum = this.cartHaveQtyTS.length;
        }
        // 选择数量等于全部数量时
        if (this.cartHaveQtyTS[_index].isChecked === 0) {
          this.checkedNum++;
        } else {
          if (this.checkedNum <= 0) {
            this.checkedNum = 0;
          } else {
            this.checkedNum--;
          }
        }
        this.allChecked = this.checkedNum === this.cartHaveQtyTS.length;
        if (this.cartHaveQtyTS.length == 1 && this.cartHaveQtyTS[_index].ischecked == 1) {
          this.allChecked = true;
        }
      },
      // 全选/反选
      async handleSelectAll() {
        if(this.cartNavbarIndex == 0){
          //  普通商品
          for (let i = 0; i < this.cartHaveQty.length; i++) {
            const _tag = this.cartHaveQty[i];
            if(this.allChecked){
              if(_tag.isChecked) await this.checkGoods(_tag.skuId, 0);
            }else{
              if(!_tag.isChecked) await this.checkGoods(_tag.skuId, 1);
            }
          }
        }else{
          //  TS商品
          for (let i = 0; i < this.cartHaveQtyTS.length; i++) {
            const _tag = this.cartHaveQtyTS[i];
            if(this.allChecked){
              if(_tag.isChecked) await this.checkGoods(_tag.skuId, 0);
            }else{
              if(!_tag.isChecked) await this.checkGoods(_tag.skuId, 1);
            }
          }
        }
        this.allChecked = !this.allChecked;
        //  获取购物车列表
        this.getCartItems();
      },
      //  父级调用子组件获取购物车列表的方法
      getCartListMethod() {
        this.getCartItems();
      },
			/**
			 * 点击数量 调起键盘修改
			 * @param {Object} item
			 */
			handleCartInputClick(item, index){
				this.cartInputVal = item.qty;
				this.cartInputIndex = index;
			},
			/**
			 * 输入框输入时回调方法
			 * @param {Object} e
			 */
			handleCartNumberInput(e){
				// const {currentTarget:{dataset:{index, id}}, detail:{value}} = e;
				// let _index = parseInt(index);
				// const _tag = this.cartNavbarIndex == 0 ? this.listData[_index] : this.tsListData[_index];
				// let limitPurchaseQty = _tag.limitPurchaseQty;
				// let qty = _tag.qty;
				// const reg = /^\d+$/;
				// if(value && !reg.test(value)){
				// 	this.cartInputVal = qty;
				// 	return this.handleShowTextToast('请输入数字');
				// }
				// let _val = parseInt(value);
				
				// if(_val <= 0){
				// 	this.cartInputVal = 1;
				// 	return this.handleShowTextToast('购买数量低于购买范围');
				// }
				
				// if (_val >= limitPurchaseQty && limitPurchaseQty != -1) {
				//   this.handleShowTextToast('已超出限购数量，详情请咨询顾问')
				//   return false;
				// }

			},
			/**
			 * 输入框修改商品数量
			 * @param {Object} e
			 */
			handleCartNumberBlur(e){
				const {currentTarget:{dataset:{index, id}}, detail:{value}} = e;
				
				let _index = parseInt(index);
				const _tag = this.cartNavbarIndex == 0 ? this.listData[_index] : this.tsListData[_index];
				if(_tag){
					let qty = _tag.qty;
					let stockQty = _tag.stockQty;
					let limitPurchaseQty = _tag.limitPurchaseQty;
					if(!value){
						this.cartInputIndex = -1;
						return this.cartInputVal = qty;
					}
					const reg = /^\d+$/;
					if(value && !reg.test(value)){
						this.cartInputVal = qty;
						this.cartInputIndex = -1;
						return this.handleShowTextToast('请输入数字');
					}
					let _val = parseInt(value);
					if(_val <= 0){
						this.cartInputVal = 1;
						_val = 1;
						this.handleShowTextToast('购买数量低于购买范围');
					}
					if(_val === qty){
						return this.cartInputIndex = -1;
					}
					
					if(limitPurchaseQty != -1){
						if (_val >= limitPurchaseQty) {
							this.cartInputVal = limitPurchaseQty;
							_val = limitPurchaseQty;
						  this.handleShowTextToast('已超出限购数量，详情请咨询顾问');
						}
					}else{
						if(_val > stockQty){
							this.cartInputVal = stockQty;
							_val = stockQty;
							this.handleShowTextToast('商品库存不足');
						}
					}
					this.addGoodFullNum(id, _val, _index);
				}
			},
      // 减少购物车商品加购数量
      jianBtnTap(e) {
        if (new Date().getTime() - this.operatingTime < 1000) return false;
        this.operatingTime = new Date().getTime();
        const { currentTarget:{ dataset:{ id, index } } } = e;
        let _index = parseInt(index);
        let num = this.cartNavbarIndex == 0 ? this.listData[_index].qty : this.tsListData[_index].qty;
        // 如果只有1件了，就不允许再减了
        if (num === 1) {
          // num--;
          // this.handleShowTextToast('购买数量低于购买范围')
          this.operating = false;
          return;
        } else {
          num = -1;
          this.addGoodNum(id, num, _index);
        }
      },
      // 增加购物车商品加购数量
      jiaBtnTap(e) {
        if (new Date().getTime() - this.operatingTime < 1000) return false;
        this.operatingTime = new Date().getTime()
        this.operating = true;
        const { currentTarget:{ dataset:{ id, index } } } = e;
        let _index = parseInt(index);
        const _tag = this.cartNavbarIndex == 0 ? this.listData[_index] : this.tsListData[_index];
        let qty = _tag.qty;
        let stockQty = _tag.stockQty;
        let limitPurchaseQty = _tag.limitPurchaseQty;
        //库存不足
        if (qty === stockQty) {
          this.operating = false;
          // this.handleShowTextToast('商品库存不足')
          this.handleCartToast({success: false, msg:'商品库存不足'})
          return false;
        } else {
          if (qty >= limitPurchaseQty && limitPurchaseQty != -1) {
            this.handleCartToast({success: false, msg:'已超出限购数量，详情请咨询顾问'})
            return false;
          }
          let num = 1;
          this.addGoodNum(id, num, _index);
        }
      },
      // 去结算
      toPayOrder(e) {
        if (e.timeStamp - this.touchStartTime > 2000) {
          this.settleAccounts();
        }
        this.touchStartTime = e.timeStamp;
      },
      // 跳转商场页面
      goIndex() {
        uni.reLaunch({
          url: '/pages/item/categoryNew'
        });
      },
      // 获取cart_key
      getCartKey() {
        this.cartKey = getApp().globalData.cartKey || uni.getStorageSync(CART_KEY);
        return this.cartKey;
      },
      // 初始化用户信息和购物车
      async initUserCart() {
        let that = this;
        try {
          let cart_key = uni.getStorageSync(CART_KEY) || '';
          const accountInfo = uni.getAccountInfoSync()
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO);
          let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
          if (customerInfo.jwt) {
            const customerResultInfo = await api.getCustomerInfo({
                method: 'GET',
                header: {
                  jwt: customerInfo.jwt
                },
                query: {}
              },
              customerInfo.customerId,
              customerInfo.merchantId
            );
            if (customerResultInfo.code !== 1000) {
              let checkUserInfo = await api.checkUser({
                method: 'POST',
                query: {
                  appId: accountInfo.miniProgram.appId,
                  merchantId: customerInfo.merchantId,
                  openId: customerInfo.openId,
                  loginToken: userSpecialInfo.loginToken
                }
              });
              if (checkUserInfo.code === 1000) {
                uni.setStorageSync(CUSTOMER_INFO, checkUserInfo.data);
                getApp().globalData.customerInfo = checkUserInfo.data
                customerInfo = checkUserInfo.data;
              }
            }
            let res = await api.checkCart({
              method: 'POST',
              header: {
                jwt: customerInfo.jwt
              },
              query: {
                customerId: customerInfo.customerId,
                merchantId: merchantInfo.cloudMerchantId,
                orderSource: 'wxapp',
                storeId: merchantInfo.cloudMerchantStoreId
              }
            });
            // 检测购物车
            if (res.code === 1000) {
              cart_key = res.data;
              that.cartKey = cart_key;
              that.getCartItems(cart_key);
              uni.setStorageSync(CART_KEY, cart_key);
              getApp().globalData.cartKey = cart_key
            } else {
              let cartRes = await api.initCart({
                method: 'POST',
                header: {
                  jwt: customerInfo.jwt
                },
                query: {
                  customerId: customerInfo.customerId,
                  merchantId: merchantInfo.cloudMerchantId,
                  orderSource: 'wxapp',
                  storeId: merchantInfo.cloudMerchantStoreId
                }
              });
              cart_key = cartRes.data.cartKey;
              that.cartKey = cart_key;
              that.getCartItems(cart_key);
              uni.setStorageSync(CART_KEY, cart_key);
              getApp().globalData.cartKey = cart_key
            }
          } else {
            that.showLoaded = false;
            that.buttonShow = true;
          }
        } catch (err) {
          
        }
      },
      /**
       * 获取用户购物车商品信息
       * @param {Object} cart_key
       */
      async getCartItems(cart_key) {
        let that = this;
        try{
          if(!cart_key) cart_key = that.getCartKey();
          let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
          that.$commonFunction.getCartList().then(async (res) => {
            let shopCollect = res;    //  购物车原始数据
            that.cartBagItems = res;  //  购物车原始数据
            let _cartData = shopCollect.items;
            let discountsArr = [];
            let stockNumber = [];
            let stockNullList = [];   //  无库存商品集合
            let stockHaveList = [];   //  有库存商品集合
            let stockNullListTS = [];   //  无库存商品集合-TS商品
            let stockHaveListTS = [];   //  有库存商品集合-TS商品
            let _invalidData = shopCollect.invalidItems;  //  失效商品列表
            let _invalidList = [];  //  普通商品失效列表
            let _invalidListTS = [];  //  TS商品失效列表

            // 失效商品集合
            if (_invalidData !== null && !!_invalidData && _invalidData.length > 0) {
              that.buttonShow = false;
              for (let i = 0; i < _invalidData.length; i++) {
                if(_invalidData[i].hdlpImageUrl) _invalidData[i].skuImageUrl = _invalidData[i].hdlpImageUrl;
                if (_invalidData[i]["skuProperties"]) {
                  _invalidData[i].skuProperties = JSON.parse(_invalidData[i]["skuProperties"]);
                }
                // 剔除赠品
                if (_invalidData[i].isGift == 1) {
                  _invalidData.splice(i, 1);
                  i--;
                }
              }

              for (let i = 0; i < _invalidData.length; i++) {
                if(_invalidData[i]?.tsActivityMark){
                  _invalidListTS.push(_invalidData[i])
                }else{
                  _invalidList.push(_invalidData[i])
                }
              }
            }
            //  失效商品列表
            that.invalidList = _invalidList;
            that.invalidListTS = _invalidListTS;

            if (_cartData !== null && !!_cartData && _cartData.length > 0) {
              that.buttonShow = false;
              that.totalPrice = shopCollect.total;
              that.itemTotal = shopCollect.itemTotal;
              that.payment = shopCollect.payment;

              if (shopCollect.allGifts != '' && shopCollect.allGifts != null && shopCollect.allGifts != undefined) {
                that.allGifts = true;
              }
              that.discountFee = shopCollect.discountFee;
              that.postFee = shopCollect.postFee;
              that.couponFee = shopCollect.couponFee;
              that.disTotal = Number(that.discountFee / 1) + Number(that.couponFee / 1);
              that.disTotal = that.disTotal.toFixed(2);

              for (let i = 0; i < _cartData.length; i++) {
                if(_cartData[i].hdlpImageUrl) _cartData[i].skuImageUrl = _cartData[i].hdlpImageUrl;

                if (_cartData[i]['skuProperties']) {
                  _cartData[i].skuProperties = typeof(_cartData[i]['skuProperties']) == 'object' ? _cartData[i]['skuProperties'] : JSON.parse(_cartData[i]['skuProperties'])
                }
                if (_cartData[i].discounts && _cartData[i].discounts.length > 0) {
                  for (let j = 0; j < _cartData[i].discounts.length; j++) {
                    if (_cartData[i].discounts[j].isCoupon == 0 && discountsArr.indexOf(_cartData[i]
                        .discounts[j]
                        .discountName) == -1) {
                      discountsArr.push(_cartData[i].discounts[j].discountName);
                    }
                  }
                }

                // 赠品名称
                if (_cartData[i].isGift == 1) {
                  that.giftName = _cartData[i].itemName;
                } else {
                  that.giftName = '';
                }

                // 库存判断
                // if (_cartData[i]['stockQty'] == 0 || _cartData[i].skuProperties[0].approveStatus == 'instock') {
                if (_cartData[i]['stockQty'] == 0 || _cartData[i].inValid == 1 || _cartData[i].skuProperties[0].approveStatus == 'instock') {
                  // 可销售库存为0，                     是失效商品，                      已下架
                  _cartData[i].isChecked = 0;
                  _cartData[i].safe = -1;
                  stockNumber.push(i);
                  if(_cartData[i]?.tsActivityMark){
                    stockNullListTS.push(_cartData[i]);
                  }else{
                    stockNullList.push(_cartData[i]);
                  }
                } else if (_cartData[i]['stockQty'] <= _cartData[i]['qty'] + that.safeNum) {
                  if (_cartData[i]['stockQty'] < _cartData[i]['qty']) {
                    that.addGoodNum(_cartData[i]['skuId'], _cartData[i]['stockQty'], i);
                    _cartData[i]['qty'] = _cartData[i]['stockQty'];
                  }
                  _cartData[i].safe = 0;
                  if(_cartData[i]?.tsActivityMark){
                    stockHaveListTS.push(_cartData[i]);
                  }else{
                    stockHaveList.push(_cartData[i]);
                  }
                } else {
                  _cartData[i].safe = 2;
                  if(_cartData[i]?.tsActivityMark){
                    stockHaveListTS.push(_cartData[i]);
                  }else{
                    stockHaveList.push(_cartData[i]);
                  }
                }
                that.totalNum += _cartData[i].stockQty;

                if (shopCollect.customerAddressId) {
                  uni.setStorageSync(ADDRESS_ID, shopCollect.customerAddressId);
                }
              }

              that.discountsArr = discountsArr;
              if (that.discountsArr.length == 1) {
                that.discountsArr[0].indexOf('运费') !== -1
                that.onlyFreight = true
              } else {
                that.onlyFreight = false
              }
              // 购物车数量
              that.cartNum = shopCollect.availableTotalQty;
              getApp().globalData.cartNum = shopCollect.availableTotalQty;
              that.$store.commit('changeCartNum', shopCollect.availableTotalQty);
              uni.setStorageSync('cartNum', shopCollect.availableTotalQty);
            } else {
              uni.removeStorageSync('cartNum');
              that.cartNum = 0;
              // that.buttonShow = true;
            }

            if (shopCollect.availableTotalQty == 0 && that.invalidList == null) {
              that.buttonShow = true;
            }
            // 有效加购商品列表赋值
            const _listData1 = stockHaveList.concat(stockNullList);
            // if(_listData1 && _listData1.length){
            //   for (let i = 0; i < _listData1.length; i++) {
            //     const el = _listData1[i];
            //     // const _goodsRes = await that.getDetailsById(merchantInfo, el.itemId)
            //     if(_goodsRes) el.skuImageUrl = _goodsRes;
            //   }
            // }
            that.listData = _listData1;
            let _tsListData1 = stockHaveListTS.concat(stockNullListTS);
            // if(_tsListData1 && _tsListData1.length){
            //   for (let i = 0; i < _tsListData1.length; i++) {
            //     const el = _tsListData1[i];
            //     // const _goodsRes = await that.getDetailsById(merchantInfo, el.itemId)
            //     if(_goodsRes) el.skuImageUrl = _goodsRes;
            //   }
            // }
            that.tsListData = _tsListData1;
            that.cartNavbarShow = (that.tsListData.length || that.invalidListTS.length) ? true : false;
            if(that.cartNavbarShow && !that.cartNavbarClick) that.cartNavbarIndex = 1;
            const _num = that.listData.length + that.tsListData.length;
            that.$emit('listDataNum', _num);
            // let _cartHaveQty1 = stockHaveList;
            // if(_cartHaveQty1 && _cartHaveQty1.length){
            //   for (let i = 0; i < _cartHaveQty1.length; i++) {
            //     const el = _cartHaveQty1[i];
            //     const _goodsRes = await that.getDetailsById(merchantInfo, el.itemId)
            //     if(_goodsRes) el.skuImageUrl = _goodsRes;
            //   }
            // }
            that.cartHaveQty = stockHaveList;
            // let _cartHaveQtyTS1 = stockHaveListTS;
            // if(_cartHaveQtyTS1 && _cartHaveQtyTS1.length){
            //   for (let i = 0; i < _cartHaveQtyTS1.length; i++) {
            //     const el = _cartHaveQtyTS1[i];
            //     const _goodsRes = await that.getDetailsById(merchantInfo, el.itemId)
            //     if(_goodsRes) el.skuImageUrl = _goodsRes;
            //   }
            // }
            that.cartHaveQtyTS = stockHaveListTS;
            if(that.cartNavbarIndex == 0){
              if(!that.listData.length && !that.invalidList.length){
                that.buttonShow = true;
              }
              //  普通商品全选
              for (let j = 0; j < that.cartHaveQty.length; j++) {
                // 是否全部选中
                if (!that.cartHaveQty[j].isChecked) that.allChecked = false;
              }
            }else{
              if(!that.tsListData.length && !that.invalidListTS.length){
                if(!that.listData.length && !that.invalidList.length){
                  that.buttonShow = true;
                }
                that.cartNavbarIndex = 0;
              }
              //  ts商品全选
              for (let j = 0; j < that.cartHaveQtyTS.length; j++) {
                // 是否全部选中
                if (!that.cartHaveQtyTS[j].isChecked) that.allChecked = false;
              }
            }

            // 关闭loading
            that.showLoaded = false;

            //  商品促销信息查询
            let showPromotionTag = uni.getStorageSync("showPromotionTag");
            if (showPromotionTag) {
              let promotionArr = []
              that.listData.forEach(function(item, index, array) {
                promotionArr.push({
                  itemId: item.itemId,
                  skuId: item.skuId,
                  valueId: item.valueId,
                })
              })
              that.tsListData.forEach(function(item, index, array) {
                promotionArr.push({
                  itemId: item.itemId,
                  skuId: item.skuId,
                  valueId: item.valueId,
                })
              })
              // 查询商品促销信息
              that.getPromotionTag(promotionArr)
            }
            // 神策购物车浏览埋点
            if(!that.viewCartStatus){
              that.viewCartStatus = true;
              that.viewTrack();
            }
            that.isClickCoupon = !that.isClickCoupon;
          }).catch((err) => {
            that.handleShowTextToast(err.msg);
          });
        }catch(e){
         
        }
      },
      /**
       * 获取商品详情
       * @param {Object} merchantInfo
       * @param {Object} itemId
       */
      async getDetailsById(merchantInfo, itemId){
        return new Promise(async (resolve, reject)=>{
          const _res = await api.goodsDetail({
              query: {
                merchant_id: merchantInfo.cloudMerchantId,
                store_id: merchantInfo.cloudMerchantStoreId
              }
            },
            itemId
          );
          let _img = "";
          if(_res && _res.code == 1000 && _res.data && _res.data.resources && _res.data.resources.length){
            const _obj = _res.data.resources.find((item)=>item.kind == "hdlp");
            if(_obj && _obj.kind == "hdlp" && _obj.type == "image" && _obj.url) _img = _obj.url;
          }
          resolve(_img)
        })
      },
      //查询商品促销信息
      getPromotionTag: async function(promotionArr) {
        let that = this
        let customerInfo = uni.getStorageSync('customerInfo');
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || getApp().globalData.merchantInfo;
        let memberDetails = uni.getStorageSync('memberDetails') || getApp().globalData.memberDetails;
        let cgid = customerInfo.groupId;
        let clid = memberDetails.memberLevelId;
        let res = await api.cartPromotion(merchantInfo.cloudMerchantId, merchantInfo.cloudMerchantStoreId, {
          method: 'POST',
          query: promotionArr
        });
        if (res.code == 1000) {
          let promotionArr = res.data
          that.listData.forEach(function(item, index, array) {
            promotionArr.forEach(function(promotionItem, promotionIdex, promotionArray) {
              if (item.itemId == promotionItem.itemId && item.skuId == promotionItem.skuId && !!promotionItem
                .promotionTagList) {
                let arr = []
                promotionItem.promotionTagList.forEach(function(promotionListItem, promotionListIdex,
                  promotionListArray) {
                  let checkGroup = !promotionListItem.groupIds || (!!promotionListItem.groupIds &&
                    promotionListItem.groupIds.indexOf(cgid) !== -1)
                  let checkMemberLevel = !promotionListItem.memberLevels || (!!promotionListItem
                    .memberLevels && isActive && promotionListItem.memberLevels.indexOf(clid) !== -1)
                  if (promotionListItem.groupIds == null && promotionListItem.memberLevels == null) {
                    arr.push(promotionListItem)
                  } else if (promotionListItem.groupIds == null && promotionListItem.memberLevels !==
                    null && checkMemberLevel) {
                    arr.push(promotionListItem)
                  } else if (promotionListItem.groupIds !== null && promotionListItem.memberLevels ==
                    null && checkGroup) {
                    arr.push(promotionListItem)
                  } else if (promotionListItem.groupIds !== null && promotionListItem.memberLevels !==
                    null && checkGroup && checkMemberLevel) {
                    arr.push(promotionListItem)
                  }
                })
                that.$set(item, 'promotionTagList', arr)
                // that.$set(item, 'promotionTagList', promotionItem.promotionTagList)
              }
            })
          })
        }
      },
      /**
       * 勾选购物车商品
       * @param id   商品skuId
       * @param ischecked 是否选中
       * @param isGetLists 是否拉取列表
       * @returns {Promise<void>}
       */
      async checkGoods(id, ischecked, isGetLists) {
        let that = this;
        let cart_key = that.getCartKey();
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        const json = await api.cartCheck({
            method: 'PUT',
            header: { jwt: jwt },
            query: {}
          },
          cart_key,
          ischecked,
          id
        );
        if (json.code === 1000) {
          // 购物车数据
          if(isGetLists) that.getCartItems();
          return true
        } else {
          if (json.code === -1003) {
            this.handleShowTextToast(json.msg)
          }
          return false
        }
      },
      //获取单个sku详情 主要获取qty库存
      async getQtyBySku(skuId) {
        let that = this;
        if (!skuId) return false;
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        const json = await api.getSkuDetail({
            header: {
              jwt: jwt
            },
            query: {}
          },
          skuId
        );
        if (json.code === 1000) {
          that.maxQty = json.data.qty;
        }
      },
      /**
       * 修改商品数量(增量形式)
       * @param id
       * @param num
       * @param index
       * @returns {Promise<void>}
       */
      async addGoodNum(id, num, index) {
        let that = this;
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || {};
        let cart_key = that.getCartKey();
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        const json = await api.cartUpdateNum({
            method: 'PUT',
            header: {
              jwt: jwt
            },
            query: {}
          },
          cart_key,
          num,
          id
        );
        if (json.code === 1000) {
          that.operating = false;
          const _tag = that.cartNavbarIndex === 0 ? that.listData[index] : that.tsListData[index];
          if (num !== 0) {
            //  腾讯有数埋点
            let actionType = num < 0 ? 'remove_from_cart' : 'append_to_cart';
            const _skuName = _tag.itemName + _tag.skuProperties[0].valueName;
            const _skuNum = num > 0 ? num : -num;
            that.srTrackAddToCart(actionType, _tag, merchantInfo.cloudMerchantId, _skuName, _skuNum)
          }
          // 购物车数据
          that.getCartItems();
          // that.$commonFunction.getCartList().then((res) => {}).catch((err) => {});
          that.$commonSensors.editCart(_tag, num > 0 ? num : -num, !!_tag.tsActivityMark ? ['特殊'] : ['常规'], num > 0 ? '增加' : '减少')
        } else if (json.code === -1002) {
          this.handleCartToast({success: false, msg:'购买数量低于购买范围'})
        } else if (json.code === -1010) {
          this.handleCartToast({success: false, msg:'已超出限购数量，详情请咨询顾问'})
        } else {
          this.handleCartToast({success: false, msg: json.msg})
        }
      },
			/**
			 * 修改商品数量(全量修改)
			 * @param id
			 * @param num
			 * @param index
			 * @returns {Promise<void>}
			 */
			async addGoodFullNum(id, num, index) {
			  let that = this;
			  let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || {};
			  let cart_key = that.getCartKey();
			  let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
			  const json = await api.cartUpdateNumFull({
			      method: 'PUT',
			      header: {
			        jwt: jwt
			      },
			      query: {}
			    },
			    cart_key,
			    num,
			    id
			  );
			  if (json.code === 1000) {
			    that.operating = false;
			    const _tag = that.cartNavbarIndex === 0 ? that.listData[index] : that.tsListData[index];
			    if (num !== 0) {
			      //  腾讯有数埋点
			      let actionType = num < 0 ? 'remove_from_cart' : 'append_to_cart';
			      const _skuName = _tag.itemName + _tag.skuProperties[0].valueName;
			      const _skuNum = num > 0 ? num : -num;
			      that.srTrackAddToCart(actionType, _tag, merchantInfo.cloudMerchantId, _skuName, _skuNum)
			    }
			    // 购物车数据
			    that.getCartItems();
			    // that.$commonFunction.getCartList().then((res) => {}).catch((err) => {});
			    that.$commonSensors.editCart(_tag, num > 0 ? num : -num, !!_tag.tsActivityMark ? ['特殊'] : ['常规'], num > 0 ? '增加' : '减少')
			  } else if (json.code === -1002) {
			    this.handleCartToast({success: false, msg:'购买数量低于购买范围'})
			  } else if (json.code === -1010) {
			    this.handleCartToast({success: false, msg:'已超出限购数量，详情请咨询顾问'})
			  } else {
			    this.handleCartToast({success: false, msg: json.msg})
			  }
				setTimeout(()=>{
					this.cartInputIndex = -1;
					// this.cartInputVal = 1;
				}, 500)
			},
      async deleteGoods(itemData) {
        let that = this;
        let sku_id = itemData.skuId;
        let cart_key = that.getCartKey();
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || {};
        const json = await api.cartDel({
            method: 'DELETE',
            header: {
              jwt: jwt
            },
            query: {}
          },
          cart_key,
          sku_id
        );
        if (json.code === 1000) {
          this.srTrackAddToCart('remove_from_cart', itemData, merchantInfo.cloudMerchantId);
          that.getCartItems();
          // that.$commonFunction.getCartList().then((res) => {}).catch((err) => {});
        } else if (json.code === -1020) {
          // getApp().checkBlackList()
          this.handleShowTextToast(json.msg)
        }
      },
      /**
       * 腾讯有数埋点-add_to_cart
       * @param {Object} actionType
       * @param {Object} item
       * @param {Object} cloudMerchantId
       * @param {Object} sku_name
       * @param {Object} sku_num
       */
      srTrackAddToCart(actionType, item, cloudMerchantId, skuName, skuNum){
        try{
          const _openOuterItemId = uni.getStorageSync('openOuterItemId');
          const _youshuOpencc = uni.getStorageSync('youshuOpencc');
          this.$sr.track('add_to_cart', {
            "action_type": actionType,
            "sku": {
              "sku_id": item.skuCode.toString(),
              "sku_name": skuName ? skuName : item.itemName
            },
            "spu": {
              "spu_id": !!_openOuterItemId ? item.outerItemId : !!_youshuOpencc ? item.skuProperties[0].frontCode.toString() : item.itemCode.toString(),
              "spu_name": !!_youshuOpencc ? item.itemName + item.skuProperties[0].valueName : item.itemName // 若商品无spu_name时，可传sku_name信息
            },
            "sku_category": [{
              "sku_cat_id": '0',
              "sku_cat_name": "11",
              "sku_parent_cat_id": "null" // 若已是顶级类目，传"null"
            }],
            "shipping_shop": {
              "shipping_shop_id": cloudMerchantId.toString(), // 到家类型对接智慧零售入口必传
              "shipping_shop_name": "THE MACALLAN EBOUTIQUE麦卡伦" // 到家类型对接智慧零售入口必传
            },
            "sale": {
              "original_price": parseFloat(item.price),
              "current_price": parseFloat(item.price)
            },
            "sku_num": skuNum ? skuNum : item.qty,
            "primary_image_url": item.skuImageUrl
          })
        }catch(e){
         
        }
      },
      async checkAllGoods() {
        let that = this;
        let cart_key = that.getCartKey();
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        //全选1否则0
        let check = 0;
        if (!this.allChecked) {
          //原来未选中
          check = 1;
        }
        const json = await api.cartCheckAll({
            method: 'PUT',
            header: {
              jwt: jwt
            },
            query: {}
          },
          cart_key,
          check
        );
        if (json.code === 1000) {
          this.checkedNum = 0;
          this.allChecked = !this.allChecked;
          // 购物车数据
          that.getCartItems();
        } else if (json.code === -1003) {
          this.handleShowTextToast(json.msg)
        }
      },
      async settleAccounts() {
        let that = this;
        //获取购物车商品列表
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        // if (parseInt(that.totalPrice) >= 80000) {
        //   that.handleShowTextToast('单笔订单限额￥80,000，请分批下单')
        //   return false
        // } else
        if (that.totalPrice == '0.00') {
          return;
        } else {
          const json = await api.checkoutOrder({
              method: 'PUT',
              header: {
                jwt: jwt
              }
            },
            uni.getStorageSync(CART_KEY)
          );
          if (json.code === 1000 && that.totalPrice !== '0.00') {
            let skuIdArr = []
            let dataPay = json.data;
            let discountFee = dataPay.discountFee,
              postFee = dataPay.postFee,
              itemTotal = dataPay.itemTotal,
              total = dataPay.total;
            let payData = json.data.items;
            payData.map(item => skuIdArr.push(item.skuId))
            uni.navigateTo({
              url: '/pages/order/submit?skuIdArr=' + encodeURIComponent(JSON.stringify(skuIdArr))
            });

            that.productCategory = '购物车商品';
            skuIdArr = skuIdArr
            // let enableMatomo = uni.getStorageSync('enableMatomo');
            // if (enableMatomo === true) {
            //   for (let i in payData) {
            //     getApp().matomo.addEcommerceItem(JSON.stringify(payData[i].skuId), payData[i].itemName, '购物车商品',
            //       payData[i].price / 1, payData[i].qty);
            //   }
            //   getApp().matomo.trackEcommerceOrder(' ', 0, 0, 0, 0, false);
            // }
          } else if (json.code == -1003) {
            that.handleShowTextToast(json.msg)
          } else {
            that.handleShowTextToast(json.msg);
          }
        }
      },
      // 显示输入和查看优惠券
      couponOpenshow() {
        let that = this;
        this.couponShow = !this.couponShow;
        this.couponMessage = '';
      },
      // 显示可用优惠券
      couponOpen() {
        this.isShowCouponList = true;
      },
      // 关闭可用优惠券
      closeCoupon() {
        let that = this;
        // that.getCoupon = 0;
      },
      // 手动输入优惠券码
      bindKeyInput(e) {
        if (this.couponValue.length !== e.detail.value.length) {
          this.couponMessage = '';
        }
        this.couponValue = e.detail.value;
      },
      useCoupon: async function(e) {
        let couponValue = e.currentTarget.dataset.couponcode;
        this.couponRuleName = e.currentTarget.dataset.rulename;
        // this.getCoupon = 0;
        this.isShowCouponList = false;

        if (couponValue != '' && couponValue != undefined) {
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          let jwt = customerInfo.jwt;
          const json = await api.useCoupon({
              method: 'PUT',
              header: {
                jwt: jwt
              },
              query: {}
            },
            uni.getStorageSync(CART_KEY),
            couponValue
          );
          if (json.code === 1000) {
            this.getCartItems();
            this.saveCoupon = couponValue;
          } else if (
            json.code == -1000 ||
            json.code == -1001 ||
            json.code == -1002 ||
            json.code == -1013 ||
            json.code == -1015 ||
            json.code == -1016
          ) {
            this.handleShowTextToast('抱歉！该优惠券不可用');
            // this.couponValue = '';
            this.useCouponHasChoose(this.saveCoupon);
            // this.clearUseCoupon(true)
          } else if (json.code == -1011 || json.code == -1014) {
            this.handleShowTextToast('抱歉！该优惠券使用次数已超限');
            // this.clearUseCoupon(true)
          } else if (json.code == -1012) {
            this.handleShowTextToast('抱歉！该优惠券已过期');
            // this.couponValue = '';
            this.useCouponHasChoose(this.saveCoupon);
            // this.clearUseCoupon(true)
          }
        } else {
          this.handleShowTextToast('请输入有效的优惠券');
          // this.couponMessage = "请输入优惠券";
        }
      },
      useCouponByInput: async function(e) {
        let that = this;
        let couponValue = this.couponValue || e.currentTarget.dataset.couponcode;
        this.couponRuleName = e.currentTarget.dataset.rulename;
        // this.getCoupon = 0;
        this.isShowCouponList = false;

        if (couponValue != '' && couponValue != undefined) {
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          let jwt = customerInfo.jwt;
          const json = await api.useCoupon({
              method: 'PUT',
              header: {
                jwt: jwt
              },
              query: {}
            },
            uni.getStorageSync(CART_KEY),
            couponValue
          );
          if (json.code === 1000) {
            this.getCartItems();
            this.saveCoupon = couponValue;
          } else if (
            json.code == -1000 ||
            json.code == -1001 ||
            json.code == -1002 ||
            json.code == -1013 ||
            json.code == -1015 ||
            json.code == -1016
          ) {
            this.errorCouponWarn = '请输入有效的优惠券';
            setTimeout(function() {
              that.errorCouponWarn = '';
            }, 2000);
            if (!!this.saveCoupon) {
              this.useCouponHasChoose(this.saveCoupon);
            }
          } else if (json.code == -1011 || json.code == -1014) {
            this.errorCouponWarn = '抱歉！该优惠券使用次数已超限';
            setTimeout(function() {
              that.errorCouponWarn = '';
            }, 2000);
            if (!!this.saveCoupon) {
              this.useCouponHasChoose(this.saveCoupon);
            }
          } else if (json.code == -1012) {
            this.errorCouponWarn = '抱歉！该优惠券已过期';
            setTimeout(function() {
              that.errorCouponWarn = '';
            }, 2000);
            if (!!this.saveCoupon) {
              this.useCouponHasChoose(this.saveCoupon);
            }
          }
        } else {
          this.errorCouponWarn = '请输入有效的优惠券';
          setTimeout(function() {
            that.errorCouponWarn = '';
          }, 2000);
          if (!!this.saveCoupon) {
            this.useCouponHasChoose(this.saveCoupon);
          }
        }
      },
      // 恢复已选优惠券
      useCouponHasChoose: async function(couponValue) {
        if (couponValue != '' && couponValue != undefined) {
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          let jwt = customerInfo.jwt;
          const json = await api.useCoupon({
              method: 'PUT',
              header: {
                jwt: jwt
              },
              query: {}
            },
            uni.getStorageSync(CART_KEY),
            couponValue
          );
          if (json.code === 1000) {
            this.getCartItems();
          } else if (
            json.code == -1000 ||
            json.code == -1001 ||
            json.code == -1002 ||
            json.code == -1013 ||
            json.code == -1015 ||
            json.code == -1016
          ) {
            this.handleShowTextToast('抱歉！该优惠券不可用');
            this.couponValue = '';
            // this.clearUseCoupon(true)
          } else if (json.code == -1011 || json.code == -1014) {
            this.handleShowTextToast('抱歉！该优惠券使用次数已超限');
            // this.clearUseCoupon(true)
          } else if (json.code == -1012) {
            this.handleShowTextToast('抱歉！该优惠券已过期');
            this.couponValue = '';
            // this.clearUseCoupon(true)
          }
        } else {
          this.handleShowTextToast('请输入有效的优惠券');
          // this.couponMessage = "请输入优惠券";
        }
      },
      // 取消使用优惠券
      clearUseCoupon: async function(bool) {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let jwt = customerInfo.jwt;
        const json = await api.clearCoupon({
            method: 'PUT',
            header: {
              jwt: jwt
            },
            query: {}
          },
          uni.getStorageSync(CART_KEY)
        );
        if (json.code === 1000) {
          this.handleShowTextToast('取消成功');
          that.placeholder = '请输入优惠券码';
          this.couponShow = false;
          this.getCartItems();
        } else {
          this.handleShowTextToast(json.msg);
        }
      },

      /**
       * 获取可用优惠券列表
       * 自动发放的满足条件直接显示，需领取的领取之后才显示
       * 判断优惠券是否可用
       */
      getMemberCouponsByRuleIds: async function(couponRuleIds, noOpen) {
        let that = this;
        that.usableCoupon = [];
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        const couponList = await api.getValidCoupon({
            method: 'GET',
            header: {
              jwt: jwt
            },
            params: {}
          },
          couponRuleIds
        );
        if (couponList.code === 1000) {
          if (couponList.data.length > 0) {
            let usableCouponList = couponList.data;
            for (let i in usableCouponList) {
              if (usableCouponList[i].timesUsed < usableCouponList[i].timesLimit) {
                that.usableCoupon.push(usableCouponList[i]);
              }
              let c_item = [];
              let couponFailureTime = '';
              for (let j in that.usableCoupon) {
                c_item = that.usableCoupon[j];

                if (c_item.expirationDate != null && (c_item.expirationDate != undefined) & (c_item.expirationDate !=
                    '')) {
                  couponFailureTime = util.UTCformat(c_item.expirationDate);
                } else {
                  couponFailureTime = util.UTCformat(c_item['couponRule'].toDate);
                }

                let timearr = couponFailureTime.split(' '); //只取年月日
                c_item['couponRule'].toDate = timearr[0];
              }

              if (that.usableCoupon.length > 0 && !noOpen) {
                that.isShowCouponList = true;
              }
            }
          }
        }
      },
      // 获取优惠券列表
      getCouponList: async function(noOpen) {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let jwt = customerInfo.jwt;
        const couponList = await api.getPayCouponItem({
            method: 'GET',
            header: {
              jwt: jwt
            },
            query: {}
          },
          uni.getStorageSync(CART_KEY)
        );
        if (couponList.code === 1000) {
          if (couponList.data.length > 0 || couponList.data !== '') {
            let coulist = couponList.data;
            let ruleIds = [];
            for (let i in coulist) {
              ruleIds.push(coulist[i].couponRuleId);
            }
            that.couponRuleIds = ruleIds;
            that.getMemberCouponsByRuleIds(that.couponRuleIds, noOpen);
          }
        }
      },
      showUseCouponClick() {
        this.showUseCoupon = !this.showUseCoupon;
      }
    }
  };
</script>

<style lang="less">
  .goods-info {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: row;
    box-sizing: border-box;
    position: relative;
    overflow-x: hidden;
    height: 288rpx;

    .check_box{
      width: 64rpx;
      height: 100%;
      position: relative;
    }
    // .icon_check {
    //   position: absolute;
    //   top: 78rpx;
    //   left: 20rpx;
    //   width: 40rpx;
    //   height: 40rpx
    // }

    .icon_checkBox {
      position: absolute;
      top: 50%;
      left: 0rpx;
      margin-top: -16rpx;
    }

    .check_area {
      width: 64rpx;
      height: 288rpx;
      left: 0rpx;
      position: absolute;
      z-index: 2;
    }

    .goods_lists_right{
      // width: 590rpx;
      width: calc(100% - 64rpx);
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      background-color: #fafafa;
    }
    .product_img {
      width: 218rpx;
      height: 100%;
      overflow: hidden;
    }
    .product_img img{
      width: 100%;
      height: 100%;
    }

    .invalid-text {
      position: absolute;
      bottom: 0;
      width: 100%;
      text-align: center;
      line-height: 21px;
      background-color: rgba(0, 0, 0, 0.6);
      color: white;
      font-size: 12px;
    }

    .text-box {
      width: calc(100% - 218rpx);
      position: relative;
    }

    .product_name{
      width: 334rpx !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
      white-space: nowrap !important;
      font-size: 28rpx !important;
      line-height: 48rpx !important;
      font-family: NotoSansSC-Medium;
    }
    .text-box .goods-title {
      color: #444444;
      padding: 0 0 5rpx 0;
      line-height: 40rpx;
      -webkit-line-clamp: 1 !important; // 控制多行的行数
      -webkit-box-orient: vertical;
    }

    .product_model {
      color: #757575;
      font-size: 24rpx;
      line-height: 40rpx;
      font-family: FrankNew-Regular;
    }
    // 划线价
    .markPrice {
      display: flex;
      width: 180rpx;

      .linePrice {
        text-decoration: line-through;
        font-size: 36rpx;
        line-height: 36rpx;
      }

      .nowPrice {
        color: #862633;
        font-size: 36rpx;
        line-height: 36rpx;
        margin-left: 10rpx;
      }
    }

    .text-box .price {
      width: 150rpx;
      text-align: left;
      font-size: 24rpx;
      font-family: FrankNew-Regular;
      font-weight: 400;
    }

    .text-box .buy-num {
      width: 190rpx;
      height: 64rpx;
      box-sizing: border-box;
      border: 1px solid #f2f2f2;
      display: flex;
      font-size: 26rpx;
      justify-content: center;
      align-items: center;
      background-color: #fff;
      text-align: center;
    }

    .text-box .buy-num .numberBtn {
      width: 40rpx;
      height: 40rpx;
      font-size: 36rpx;
			margin: 0 12rpx;
    }


    .numjia {
      font-size: 36rpx;
    }

    .numIcon {
      font-size: 36rpx;
      line-height: 36rpx;
    }


    .text-box .buy-num input {
      width: 50rpx;

      height: 46rpx;
      min-height: 46rpx;
      text-align: center;
      font-size: 30rpx;
      z-index: 1;
      margin-top: 2rpx;
    }

    .text-box .buy-num .cart-number {
      border: none;
      width: 54rpx;
      line-height: 48rpx;
      font-size: 28rpx;
      z-index: 1;
      font-family: FrankNew-Medium;
    }
  }

  .jiesuan-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 144rpx;
    position: fixed;
    bottom: 0;
    left: 0;
    border-top: 1px solid #f2f2f2;
    background-color: #fff;
    z-index: 900;
    padding: 32rpx 48rpx;
  }

  .customer-tabbar.jiesuan-box {
    bottom: 120rpx;
  }

  .jiesuan-box-ipx.jiesuan-box {
    bottom: 150rpx;
  }

  .fix-iphonex-button {
    bottom: 0;
  }

  .fix-iphonex-button.isPb {
    bottom: 142rpx;
  }

  .jiesuan-box.isPb {
    bottom: 152rpx;
  }

  .jiesuan-box .to-pay-btn {
    width: 158rpx;
    text-align: center;
    line-height: 80rpx;
    background: url("https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/cart/cart_paybtn_active.png") no-repeat center / 100%;
    font-size: 28rpx;
    color: #ffffff;
    margin-left: 32rpx;
  }

  .jiesuan-box .no-select {
    background: url("https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/cart/cart_paybtn.png") no-repeat center / 100%;
  }

  .jiesuan-box .left-price {
    display: flex;
    width: 104rpx;
    // padding: 0 30rpx 0 20rpx;
    font-size: 28rpx;
    box-sizing: border-box;
    align-items: center;
  }
  .jiesuan-box .right-price{
    width: 550rpx;
    height: 80rpx;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .jiesuan-box .total_box{
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .jiesuan-box .total_text{
    font-size: 24rpx;
    color: #757575;
    font-family: NotoSansSC-Regular;
    font-weight: 400;
  }
  .jiesuan-box .total {
    color: #000000;
    font-size: 24rpx;
    font-weight: 500;
    padding-left: 16rpx !important;
    font-family: FrankNew-Medium;
  }

  .all_select_box {
    height: 100%;
    display: flex;
    align-items: center;
  }

  .all_select {
    flex: 1;
    padding-left: 14rpx;
    font-size: 28rpx;
    font-family: NotoSansSC-Medium;
  }

  .empty-cartHidden {
    display: none;
  }

  .empty-cartHidden.empty_cart {
    height: 880rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    .shop_btn {
      display: flex;
      width: 100%;
    }

    .block {
      margin: 0 auto;
      text-align: center;
      display: flex;
      align-items: center;
    }

    .btn_group {
      display: flex;
      align-items: center;
      padding-top: 80rpx;
      .get_store {
        margin: 0 auto;
        width: 176rpx;
        height: 80rpx;
        line-height: 80rpx;
        background-color: #CB171A;
        border-radius: 48rpx 16rpx 48rpx 48rpx;
        font-size: 28rpx;
        font-weight: 500;
        font-family: NotoSansSC-Regular;
        color:#fff;
      }
    }
  }
  .empty_cart_text {
    font-family: NotoSansSC-Regular;
    color: #000000;
    font-size: 14px;
    line-height: 24px;
    margin-top: 40rpx;
    text-align: center;
  }

  page {
    background-color: #fff;
    // padding-bottom: 100rpx;
  }

  .total-section {
    line-height: 52rpx;
  }

  .noStock {
    margin-right: 10rpx;
    color: #862633;
    display: none;
  }

  .total {
    padding-left: 26rpx;
  }

  .sale {
    color: #862633;
    text-align: right;
  }

  .sale.act {
    color: #862633;
    text-align: right;
  }

  .number {
    padding-top: 3px;
  }

  .bottomBox {
    // width: 334rpx;
    width: 342rpx;
    margin-top: 24rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .goodsList {
    position: relative;
    padding-top: 32rpx;
    margin-bottom: 80rpx;
  }

  .recently_viewed{
    width: 100%;
    // height: 812rpx;
  }
  .recently_lists_progress{
    width: 320rpx;
    height: 68rpx;
    position: relative;
    padding: 32rpx 0;
    margin: 32rpx auto 0 auto;
  }
  .recently_lists_progress_bg{
    width: 320rpx;
    height:4rpx;
    background-color: #c6c6c6;
  }
  .recently_lists_progress_line{
    width: 80rpx;
    height: 4rpx;
    background-color: #000;
    position: absolute;
    left:0;
    top:32rpx;
    transform: translateX(0);
    transition: all 30ms linear;
  }
  .recently_lists_box{
    width: 100%;
    height:596rpx;
  }
  ::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    color: transparent;
  }
  .recently_lists_inner{
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-left: 32rpx;
  }
  .recently_lists_item{
    width:318rpx;
    height:596rpx;
    margin-left:16rpx;
    flex-shrink: 0;
  }
  .lists_img_box{
    width: 100%;
    height:424rpx;
    overflow: hidden;
    position: relative;
    background: #fafafa;
  }
  .text24{
    font-size: 24rpx;
    line-height: 40rpx;
  }
  .lists_classname{
    height: 40rpx;
    margin-top: 24rpx;
    color: #757575;
    font-family: FrankNew-Regular;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .lists_itemname{
    color: #000;
    font-family: FrankNew-Medium,NotoSansSC-Medium;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .lists_price{
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-family: FrankNew-Regular;
    margin-top: 24rpx;
    font-weight: 400;
  }
  .lists_price_yuan{
    font-family: NotoSansSC-Regular;
  }
  .cart_btn{
    width: 48rpx;
    height: 48rpx;
    background: url("https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/icon_cart.png") no-repeat center / 100% 100%;
    position: absolute;
    right: 16rpx;
    bottom: 16rpx;
    z-index: 19;
  }
  .block_title{
    font-size: 36rpx;
    line-height: 52rpx;
    font-family: NotoSansSC-Medium;
    width: 100%;
    padding-left: 48rpx;
    box-sizing: border-box;
    padding-bottom: 32rpx;
    padding-top: 80rpx;
    font-weight: 500;
  }

  .invalid_product_status{
    font-family: FrankNew-Regular;
    font-size: 24rpx;
  }

  .fix-iphonex-goodsList {
    margin-bottom: 180rpx;
  }

  .del_text {
    position: absolute;
    right: 20rpx;
    top: 1.5rpx;
    z-index: 6;
    color: #ddd;
    font-size: 20rpx;
  }

  .icon-cuowu1 {
    position: absolute;
    right: 0;
    top: -2px;
    font-size: 20px;
  }

  /* 删除确认 */

  .o-contain {
    padding: 130rpx 24rpx 0;
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background-color: #fff;
    z-index: 20;
    margin-top: 50px;
  }

  .o-contain.is-hidden {
    display: none;
  }

  .o-contain .a-heading-2 {
    letter-spacing: 0.0825em;
    text-transform: uppercase;
    margin: 10rpx 0 34rpx 0;
    width: 100%;
    display: block;
    text-align: center;
  }

  .o-contain .a-paragraph {
    margin: 15px 0 35px;
  }

  .o-contain .a-button {
    background-color: #fff;
  }

  .o-contain .a-button.is-primary {
    color: #444;
    background-color: #fff;
    line-height: 21px;
    letter-spacing: 0.0825em;
    text-transform: uppercase;
    font-weight: 400;
    text-align: center;
    width: 100%;
    padding: 12px 0 8px;
    display: block;
    border: 1px solid #444;
  }

  .o-contain .a-button.is-secondary {
    color: #fff;
    background-color: #444;
    border: 1px solid #e7e7e7;
    line-height: 21px;
    letter-spacing: 0.0825em;
    text-transform: uppercase;
    font-weight: 400;
    text-align: center;
    width: 100%;
    padding: 12px 9px 8px;
    margin-bottom: 40rpx;
  }

  .is-visible {
    display: block;
  }

  .cartTotal {
    margin-top: 40rpx;
    padding: 0 38rpx;
    padding-bottom: 120rpx;
  }

  .cartTotal .item {
    display: flex;
    justify-content: space-between;
    font-size: 26rpx;
    margin-bottom: 34rpx;
  }

  .cartTotal .item .look-coupon-list {
    border-bottom: 1px solid #000;
    line-height: 34rpx;
    font-size: 26rpx;
    margin-top: 2rpx;
  }

  .cartTotal .item .total {
    font-size: 26rpx;
    font-family: rutanRegular;
  }

  .cartTotal .item .coupon_act {
    color: #000;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    width: 80%;
  }

  .cartTotal .item .coupon_act .cancel-coupon {
    color: #999;
    border-bottom: 1px solid #999;
    display: inline-block;
    margin-right: 20rpx;
  }

  .couponInput {
    border: 1px solid #7f7f7f;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .couponInput input {
    width: 100%;
    height: 60rpx;
    line-height: 60rpx;
    font-size: 15px;
    padding: 0px;
    flex: 1;
    padding-left: 10rpx;
    font-size: 24rpx;
  }

  .couponInput .btn {
    height: 60rpx;
    line-height: 60rpx;
    background-color: #7f7f7f;
    color: #fff;
    font-size: 24rpx;
    width: 200rpx;
    text-align: center;
  }

  .couponList {
    padding: 40rpx;
    margin-top: 50rpx;
    padding-bottom: 200rpx;
  }

  .couponList .item {
    background-color: #f0f0f0;
    padding: 20rpx;
    margin-bottom: 30rpx;
    display: block;
    color: #999;
  }

  .couponList .item label {
    display: block;
    margin-bottom: 6rpx;
    font-size: 26rpx;
    color: #000;
  }

  .cartTotal .couponBox {
    position: relative;
    font-size: 26rpx;
    display: block;
  }

  .cartTotal .couponTitle {
    display: flex;
    justify-content: flex-end;
  }

  .cartTotal .aos_mp {
    font-size: 26rpx;
  }

  .cartTotal .aos_mp-arrow-down {
    width: 42rpx;
  }

  .cartTotal .aos_mp-arrow-down:before {
    content: '';
  }

  .cartTotal .aos_mp-arrow-down:after {
    content: '\e60c';
    font-size: 32rpx;
    position: absolute;
    right: 0;
    top: 0;
    color: #000;
  }

  .cartTotal .aos_mp-arrow-down.act {
    transform: rotate(180deg);
  }

  .cartTotal .couponInput .weui-input {
    border-bottom: 1px solid #000;
    height: 40rpx;
    margin-top: 10rpx;
  }

  .cartTotal .couponInput button {
    margin: 60rpx 0;
    text-align: center;
    border: 2px solid #000;
    border-radius: 0;
    background-color: #fff;
    font-size: 26rpx;
    font-family: syHeavy;
  }

  .cartTotal .couponName {
    margin-left: 30rpx;
  }

  .cartTotal .couponList {
    padding: 0 40rpx 200rpx 40rpx;
  }

  .cartTotal .couponList li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40rpx;
  }

  .cartTotal .couponList strong {
    display: block;
    font-size: 26rpx;
    font-family: syHeavy;
  }

  .couponText {
    display: flex;
  }

  .couponText .cancel {
    display: inline-block;
    color: #000;
    border-bottom: 1px solid #000;
  }

  /* 已加入购物车商品售完的情况 */
  .noGoods .goods-info .text-box .goods-title,
  .noGoods .goods-info .lable .bo-label,
  .noGoods .goods-info .markPrice .linePrice,
  .noGoods .goods-info .markPrice .nowPrice {
    color: #d8d8d8;
  }

  .noGoods .goods-info .text-box .buy-num {
    display: none;
  }

  .topBox {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh;
    background-color: #fff;
    z-index: 9999;
    overflow-y: auto;
    margin-top: 116rpx;
    padding: 0;
  }

  .topBox .a-icon-close {
    top: 40rpx;
    right: 20rpx;
    position: absolute;
  }
  /* 签名弹框 */
  .topBoxSmall .cont {
    height: auto;
  }

  .autograph {
    text-align: center;
    font-size: 28rpx;
  }

  .autograph .box {
    padding: 60rpx 0;
    line-height: 60rpx;
    width: 70%;
    margin: auto;
  }

  .autograph label {
    font-size: 30rpx;
    display: block;
    line-height: 56rpx;
  }

  .autograph .btnBox {
    display: flex;
    justify-content: center;
    margin-top: 50rpx;
  }

  .autograph .btnBox .btn1 {
    border: 1px solid #000;
    background-color: #fff;
    width: 200rpx;
  }

  .autograph .btnBox .btn2 {
    background-color: #000;
    color: #fff;
    margin-left: 30rpx;
    width: 200rpx;
  }

  .cpTitle {
    font-size: 36rpx;
    text-align: center;
    margin: 0 0 50rpx 0;
  }

  .couponItem {
    background-color: #f0f0f0;
    padding: 20rpx;
    margin-bottom: 30rpx;
  }

  .couponItem.act {
    border: 1px solid #000;
  }

  .couponItem label {
    display: block;
    color: #000;
    font-size: 26rpx;
  }

  .couponItem text {
    color: #999;
  }

  .salePrice {
    font-size: 26rpx;
  }

  .check_1 {
    background-color: #000;
    color: #fff;
    padding: 4rpx 4rpx 6rpx 4rpx;
    font-size: 23rpx;
    width: 28rpx;
    height: 26rpx;
    margin-top: 88rpx;
  }

  .discounts-arr-box {
    max-width: 270px;
  }

  .discounts-item {
    display: block;
    text-align: right;
  }

  .discounts-item:last-child {
    padding-right: 0;
    border-right: 1px solid transparent;
  }

  .warn-info {
    font-size: 26rpx;
    position: absolute;
    left: 0;
    top: 0rpx;
    color: #862633;
  }

  .cartTotal .giftBox {
    font-size: 26rpx;
    padding-top: 30rpx;
  }

  .warn-coupon {
    color: #862633;
    font-size: 26rpx;
    text-align: center;
  }

  .mb20 {
    margin-bottom: 20rpx;
  }

  .cartCoupon {
    padding-bottom: 8rpx;
    margin-bottom: 26rpx;
  }

  /* 已加入购物车商品售完的情况 */
  .noGoods .goods-info .text-box .goods-title,
  .noGoods .goods-info .lable .bo-label,
  .noGoods .goods-info .markPrice .linePrice,
  .noGoods .goods-info .markPrice .nowPrice {
    color: #d8d8d8;
  }

  .noGoods .goods-info .text-box .price {
    color: #d8d8d8;
  }

  .noGoods .goods-info .text-box .buy-num {
    display: none;
  }

  .cp {
    position: relative;
  }

  .icon-jiantouxiangyou {
    width: 32rpx;
    height: 32rpx;
    transform: rotate(90deg);
    display: inline-block;
    position: absolute;
    left: 90rpx;
    top: 2rpx;
  }

  .icon-jiantouxiangyou.act {
    transform: rotate(270deg);
    left: 90rpx;
    top: 0;
  }

  .text-box {
    width: 490rpx;
    position: relative;
  }

  .text-box .goods-title {
    font-size: 28rpx;
    color: #444444;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    padding: 0 20rpx 5rpx 0;
  }

  .text-box .lable {
    font-size: 26rpx;
    color: #999;
  }

  .soldOut {
    margin-right: 10rpx;
    color: #ccc;
    position: absolute;
    bottom: -8rpx;
  }

  .promotion-box {
    display: flex;
    flex-flow: row wrap;
  }

  .promotion-item {
    padding: 4rpx 6rpx;
    margin-right: 10rpx;
    color: rgb(117, 249, 76);
    border: 1px solid rgb(117, 249, 76);
    font-size: 10px;
    margin-bottom: 10rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .icon-xl {
    width: 108.38rpx;
    height: 80rpx;
    display: block;
    margin: 0 auto;
  }

  .invalid_color {
    color: #757575 !important;
  }

  .mark {
    line-height: 24rpx;
    font-size: 24rpx;
    margin-right: 4rpx;
    font-family: NotoSansSC-Medium;
    font-weight: 500;
  }
  .mark_regular{
    font-family: NotoSansSC-Regular;
    line-height: 24rpx;
    font-size: 24rpx;
    margin-right: 4rpx;
    font-weight: 400;
  }

  .outerLayer {
		width: 66rpx;
    // width: 54rpx;
    height: 100%;
    display: flex;
    align-items: center;
    // margin-right: 12rpx;
  }

  .flex_end{
    justify-content: flex-end;
  }
  .flex_start{
    justify-content: flex-start;
  }

  .cart_navbar_box{
    width: 100%;
    height: 112rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f2f2f2;
  }
  .cart_navbar_item{
    width: 327rpx;
    line-height: 112rpx;
    text-align: center;
    color: #c6c6c6;
    font-family: NotoSansSC-Medium;
    position: relative;
  }
  .vector_icon{
    width: 28rpx;
    height: 14rpx;
    position: absolute;
    left: 50%;
    margin-left: -14rpx;
    bottom: -7rpx;
  }
  .sel_icon{
    width: 32rpx;
    height: 32rpx;
  }
	.cart_number_box{
		position: relative;
		overflow: hidden;
	}
	.cart_number_input{
		position: absolute;
		left: -9999rpx;
		top: -9999rpx;
		z-index: -199;
		width: 54rpx;
		opacity: 0;
	}
</style>
